package com.haiyisoft.eclipse.uep.visual.ui.editor;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.editor.FormEditor;

public class OverViewEditor extends FormEditor  {
	
	public OverViewEditor() {
	}
	
	public OverViewEditor(IDocument document,FileInfo fileInfo,ICompilationUnit cu) {
		this.fileInfo=fileInfo;
		this.document=document;
		this.cu=cu;
	}
	
	private IDocument document;
	private CreateOverViewPage page;
	private FileInfo fileInfo;
	private ICompilationUnit cu;
	
	@Override
	protected void addPages() {
		try {  
	          page = new CreateOverViewPage(this, fileInfo, document, "OverViewEditor", cu); 
	          addPage(page);  
	          CTabFolder tab=(CTabFolder)getContainer();
	          tab.setTabHeight(0);
	      } catch (PartInitException e) {  
	          e.printStackTrace();  
	      }
		
	}
	@Override
	public void doSave(IProgressMonitor monitor) {
		fileInfo=page.getFileInfo();
		page.setDirty(false);  
        page.getManagedForm().staleStateChanged();  
        editorDirtyStateChanged();
        
	}
	@Override
	public void doSaveAs() {
		// TODO Auto-generated method stub
		
	}
	@Override
	public boolean isSaveAsAllowed() {
		// TODO Auto-generated method stub
		return false;
	}
	
}
